package com.logo.egitim.crm.service;

import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.inject.Inject;

import com.logo.egitim.crm.dao.DepartmanDao;
import com.logo.egitim.crm.dao.GenericDao;
import com.logo.egitim.crm.entity.Departman;

public class DepartmanService extends GenericService<Departman>{

	@Inject DepartmanDao departmanDao;
	
	@Override
	public GenericDao<Departman> getDao() {
		return departmanDao;
	}
	
	@Override
	@TransactionAttribute(TransactionAttributeType.REQUIRED)
	public boolean kaydet(Departman nesne) {
		if(nesne.getAd().length() < 3)
			return false;
		return super.kaydet(nesne);
	}

}
